package com.aspose.cells;

import java.util.Iterator;

class zig implements zafz {
   private zn k;
   private zbp l;
   private zbp m;
   private zbp n;
   private zbp o;
   private zbto p;
   private int q;
   private zbcs r;
   private zix s;
   private zix t;
   private ziq u;
   private boolean v;
   private boolean w;
   private boolean x;
   private zakx y;
   private zbp z;
   private int A;
   private int B;
   private int C;
   private int D;
   private int E;
   private int F;
   private zbvd G;
   private zbvd H;
   private zbvd I;
   private zvt J;
   private boolean K;
   private boolean L;
   private boolean M;
   private boolean N;
   private String O;
   private zii P;
   private boolean Q;
   private int R;
   private zbtf S;
   private int T;
   private int U;
   private zxx V;
   private zbly W;
   private int X = 0;
   private int Y = 0;
   private int Z = 0;
   private com.aspose.cells.b.a.b.zq aa;
   private float ab = 0.0F;
   boolean a = false;
   zbp b;
   double c;
   double d;
   int e;
   int f;
   int g;
   int h;
   private com.aspose.cells.b.a.b.zt ac = com.aspose.cells.b.a.b.zt.a();
   com.aspose.cells.b.a.b.zp i = com.aspose.cells.b.a.b.zp.a();
   boolean j = false;
   private boolean ad = false;
   private ImageFormat ae = ImageFormat.getBmp();
   private boolean af = false;
   private boolean ag = false;

   public zig(com.aspose.cells.b.a.b.zg var1, Color var2) {
      this.a(var1, var2);
   }

   public zig() {
      this.a((com.aspose.cells.b.a.b.zg)null, Color.getEmpty());
   }

   private void a(com.aspose.cells.b.a.b.zg var1, Color var2) {
      this.R = 2;
      this.S = new zbtf();
      this.s = new zix(this, this, 0, 0);
      this.s.a(480);
      this.s.b(288);
      Color var3 = this.s.j();
      this.s.b(var1);
      if (!var2.isEmpty()) {
         this.s.a(var2);
      }

      this.l = new zbp(this, 0);
      this.m = new zbp(this, 2);
      this.m.d(false);
      this.n = new zbp(this, 1);
      this.o = new zbp(this, 3);
      this.o.d(false);
      this.z = new zbp(this, 4);
      this.z.d(false);
      this.u = new ziq(this);
      this.v = false;
      this.w = true;
      this.x = true;
      this.y = new zakx(this, this, 10);
      this.r = new zbcs(this);
      this.t = new zix(this, this, 1, 1);
      this.p = new zbto(this, this, 8, 10);
      this.q = 14;
      this.A = 100;
      this.B = 150;
      this.C = 150;
      this.F = 100;
      this.D = 15;
      this.E = 20;
      this.G = new zbvd(this);
      this.H = new zbvd(this);
      this.I = new zbvd(this);
      this.J = new zvt(this);
      this.W = new zbly(this);
      this.K = false;
      this.L = true;
      this.M = true;
      this.N = false;
      this.O = "Aspose.Cells for .NET";
      this.P = new zii();
      this.Q = true;
      this.V = new zxx();
   }

   public int a() throws Exception {
      return this.s.l() == 0 ? 1 : this.s.l();
   }

   public int b() throws Exception {
      return this.s.m() == 0 ? 1 : this.s.m();
   }

   public int c() {
      return this.T;
   }

   public void a(int var1) {
      this.T = var1;
   }

   public int d() {
      return this.U;
   }

   public void b(int var1) {
      this.U = var1;
   }

   zbp e() {
      return this.l;
   }

   public zafo f() {
      return this.l;
   }

   zbp g() {
      return this.m;
   }

   public zafo h() {
      return this.m;
   }

   zix i() {
      return this.s;
   }

   public zagc j() {
      return this.s;
   }

   ziq k() {
      return this.u;
   }

   public zagb l() {
      return this.u;
   }

   public int m() {
      return this.A;
   }

   public void c(int var1) {
      if (var1 >= 20 && var1 <= 2000) {
         this.A = var1;
      }

   }

   public int n() {
      return this.B;
   }

   public void d(int var1) {
      if (var1 >= 0 && var1 <= 500) {
         this.B = var1;
      }

   }

   public int o() {
      return this.C;
   }

   public void e(int var1) {
      if (var1 >= 0 && var1 <= 500) {
         this.C = var1;
         Iterator var2 = this.r.iterator();

         while(var2.hasNext()) {
            zbcq var3 = (zbcq)var2.next();
            var3.e(var1);
         }
      }

   }

   public int p() {
      return this.D;
   }

   public void f(int var1) {
      this.D = var1;
   }

   public int q() {
      return this.F;
   }

   public void g(int var1) {
      this.F = var1;
   }

   public boolean r() {
      return this.M;
   }

   public void a(boolean var1) {
      this.M = var1;
   }

   public void b(boolean var1) {
      this.L = var1;
   }

   zvt s() {
      return this.J;
   }

   public zags t() {
      return this.J;
   }

   public boolean u() {
      return this.v;
   }

   public void c(boolean var1) {
      this.v = var1;
   }

   public boolean v() {
      return this.w;
   }

   public void d(boolean var1) {
      this.w = var1;
   }

   public boolean w() {
      return this.x;
   }

   public void e(boolean var1) {
      this.x = var1;
   }

   zakx x() {
      return this.y;
   }

   public zahc y() {
      return this.y;
   }

   zbcs z() {
      return this.r;
   }

   public zahw A() {
      return this.r;
   }

   zix B() {
      return this.t;
   }

   public zagc C() {
      return this.t;
   }

   public boolean D() {
      return this.N;
   }

   public void f(boolean var1) {
      this.N = var1;
   }

   public int E() {
      return this.E;
   }

   public void h(int var1) {
      this.E = var1;
   }

   zbp G() {
      return this.n;
   }

   public zafo F() {
      return this.n;
   }

   zbp I() {
      return this.o;
   }

   public zafo H() {
      return this.o;
   }

   zbp K() {
      return this.z;
   }

   public zafo J() {
      return this.z;
   }

   zbto M() {
      return this.p;
   }

   public zaig L() {
      return this.p;
   }

   public int N() {
      return this.q;
   }

   public void i(int var1) {
      this.q = var1;
   }

   zbvd S() {
      return this.G;
   }

   public zaij O() {
      return this.G;
   }

   zbvd U() {
      return this.H;
   }

   public zaij Q() {
      return this.H;
   }

   zbvd V() {
      return this.I;
   }

   public zaij P() {
      return this.I;
   }

   public boolean X() {
      return this.K;
   }

   public void h(boolean var1) {
      this.K = var1;
   }

   public void a(String var1) {
      this.O = var1;
   }

   public boolean Y() {
      return this.Q;
   }

   public void i(boolean var1) {
      this.Q = var1;
   }

   public zaga W() {
      return this.P;
   }

   public int R() {
      return this.R;
   }

   public void j(int var1) {
      this.R = var1;
   }

   zbtf Z() {
      return this.S;
   }

   public void a(Color[] var1) {
      this.S.a().a(var1);
   }

   boolean aa() {
      int var1 = this.N();
      switch(var1) {
      case 3:
      case 4:
      case 5:
      case 9:
      case 10:
      case 11:
      case 17:
      case 18:
      case 19:
      case 20:
      case 21:
      case 22:
      case 23:
      case 24:
      case 25:
      case 26:
      case 27:
      case 28:
      case 29:
      case 30:
      case 31:
      case 32:
      case 33:
      case 34:
      case 43:
      case 45:
      case 48:
      case 50:
      case 51:
      case 52:
      case 53:
      case 54:
      case 55:
      case 56:
      case 69:
      case 70:
      case 71:
      case 72:
         return true;
      case 6:
      case 7:
      case 8:
      case 12:
      case 13:
      case 14:
      case 15:
      case 16:
      case 35:
      case 36:
      case 37:
      case 38:
      case 39:
      case 40:
      case 41:
      case 42:
      case 44:
      case 46:
      case 47:
      case 49:
      case 57:
      case 58:
      case 59:
      case 60:
      case 61:
      case 62:
      case 63:
      case 64:
      case 65:
      case 66:
      case 67:
      case 68:
      default:
         return false;
      }
   }

   zbly ab() {
      return this.W;
   }

   com.aspose.cells.b.a.b.zg ac() {
      return this.s.h();
   }

   Color ad() {
      return this.s.j();
   }

   int ae() {
      return this.X;
   }

   void k(int var1) {
      this.X = var1;
   }

   int af() {
      return this.Y;
   }

   void l(int var1) {
      this.Y = var1;
   }

   int ag() {
      return this.Z;
   }

   void m(int var1) {
      this.Z = var1;
   }

   void a(com.aspose.cells.b.a.b.zq var1) {
      this.aa = var1;
   }

   float ah() {
      return this.ab;
   }

   void a(float var1) {
      this.ab = var1;
   }

   com.aspose.cells.b.a.b.zp ai() throws Exception {
      int var1 = this.a();
      return new com.aspose.cells.b.a.b.zp((int)((double)((float)this.e * 4000.0F / (float)this.a()) + 0.5D), (int)((double)((float)this.f * 4000.0F / (float)this.b()) + 0.5D), (int)((double)((float)this.g * 4000.0F / (float)this.a()) + 0.5D), (int)((double)((float)this.h * 4000.0F / (float)this.b()) + 0.5D));
   }

   void a(int var1, int var2, int var3, int var4) {
      this.e = var1;
      this.f = var2;
      this.g = var3;
      this.h = var4;
   }

   com.aspose.cells.b.a.b.zt aj() throws Exception {
      return this.ac.d() ? new com.aspose.cells.b.a.b.zt((float)this.a(), (float)this.b()) : this.ac;
   }

   void a(com.aspose.cells.b.a.b.zt var1) {
      this.ac = var1;
   }

   public com.aspose.cells.b.a.b.zs T() throws Exception {
      this.i().d().k();
      int var1 = this.i().d().h();
      return var1 <= 1 ? new com.aspose.cells.b.a.b.zs(this.a(), this.b()) : new com.aspose.cells.b.a.b.zs(this.a() + var1, this.b() + var1);
   }

   com.aspose.cells.b.a.b.zp ak() throws Exception {
      this.i().d().k();
      int var1 = this.i().d().h();
      int var2 = var1 / 2;
      return new com.aspose.cells.b.a.b.zp(var2, var2, this.a(), this.b());
   }

   void a(com.aspose.cells.b.a.b.zp[] var1) throws Exception {
      com.aspose.cells.b.a.b.zq var2 = new com.aspose.cells.b.a.b.zq((float)var1[0].c(), (float)var1[0].d(), (float)var1[0].e(), (float)var1[0].f());
      com.aspose.cells.b.a.b.zq[] var3 = new com.aspose.cells.b.a.b.zq[]{var2};
      this.a(var3);
      var2 = var3[0];
      var1[0].a(zbuk.c((double)var2.f()));
      var1[0].b(zbuk.c((double)var2.g()));
      var1[0].c(zbuk.c((double)var2.h()));
      var1[0].d(zbuk.c((double)var2.i()));
   }

   void a(com.aspose.cells.b.a.b.zq[] var1) throws Exception {
      if (var1[0].f() < 0.0F) {
         var1[0].a(0.0F);
      }

      if (var1[0].g() < 0.0F) {
         var1[0].b(0.0F);
      }

      if (var1[0].l() > (float)this.a()) {
         var1[0].a((float)this.a() - var1[0].h());
      }

      if (var1[0].m() > (float)this.b()) {
         var1[0].b((float)this.b() - var1[0].i());
      }

   }

   public zxx al() {
      return this.V;
   }

   public void a(zxx var1) {
      this.V = var1;
   }

   public void am() throws Exception {
      this.i().d().k();
      this.i().c().j();
      this.ad = true;
      if (this.aa()) {
         zic.b(this);
      } else {
         zia.b(this);
      }

      this.ad = false;
   }

   boolean an() {
      return this.ad;
   }

   public zn ap() {
      return this.k;
   }

   public void a(zn var1) {
      this.k = var1;
   }

   public ImageFormat aq() {
      return this.ae;
   }

   public void a(ImageFormat var1) {
      this.ae = var1;
   }

   public void j(boolean var1) {
      this.af = var1;
   }

   public void ao() throws Exception {
      this.as();
      if (this.aa()) {
         zic.b(this);
      } else {
         zia.b(this);
      }

      this.ab().a(this.ap());
      this.at();
      this.n(100);
   }

   private void as() throws Exception {
      int var1 = this.i().d().h();
      this.i().d().k();
      this.i().c().j();
      com.aspose.cells.b.a.b.zs var2 = this.T();
      com.aspose.cells.b.a.b.zp var3 = new com.aspose.cells.b.a.b.zp(0, 0, var2.b(), var2.c());
      float var4;
      float var5;
      com.aspose.cells.b.a.b.zq var6;
      if (var1 <= 1) {
         var4 = (float)(this.a() - 1);
         var5 = (float)(this.b() - 1);
         var6 = new com.aspose.cells.b.a.b.zq(0.0F, 0.0F, var4, var5);
      } else {
         var4 = (float)this.a();
         var5 = (float)this.b();
         var6 = new com.aspose.cells.b.a.b.zq((float)var1 / 2.0F, (float)var1 / 2.0F, var4, var5);
      }

      if (this.w()) {
         this.i().c().a(var3);
         this.i().d().a(var6);
      } else {
         this.a(var6.f(), var6.g(), var6.h(), var6.i(), 13.0F);
      }

   }

   private void a(float var1, float var2, float var3, float var4, float var5) {
      com.aspose.cells.b.a.b.a.ze var6 = new com.aspose.cells.b.a.b.a.ze();
      var6.b(var1 + var5, var2, var1 + var3 - var5 * 2.0F, var2);
      var6.a(var1 + var3 - var5 * 2.0F, var2, var5 * 2.0F, var5 * 2.0F, 270.0F, 90.0F);
      var6.b(var1 + var3, var2 + var5, var1 + var3, var2 + var4 - var5 * 2.0F);
      var6.a(var1 + var3 - var5 * 2.0F, var2 + var4 - var5 * 2.0F, var5 * 2.0F, var5 * 2.0F, 0.0F, 90.0F);
      var6.b(var1 + var3 - var5 * 2.0F, var2 + var4, var1 + var5, var2 + var4);
      var6.a(var1, var2 + var4 - var5 * 2.0F, var5 * 2.0F, var5 * 2.0F, 90.0F, 90.0F);
      var6.b(var1, var2 + var4 - var5 * 2.0F, var1, var2 + var5);
      var6.a(var1, var2, var5 * 2.0F, var5 * 2.0F, 180.0F, 90.0F);
      var6.i();
      this.i().c().a(var6);
      this.i().d().a(var6);
   }

   private void n(int var1) throws Exception {
      if (this.Y()) {
         String var2 = "                Evaluation Only.\r\nCreated with " + this.O + ".\r\n" + "     (C) 2003-" + com.aspose.cells.b.a.zo.a(DateTime.getNow().getYear()) + " Aspose Pty Ltd.";
         com.aspose.cells.b.a.b.zp var3 = this.ak();
         int var4 = 10;
         String var5 = "Microsoft Sans Serif";
         com.aspose.cells.b.a.b.zg var6 = null;
         com.aspose.cells.b.a.b.zu var7 = new com.aspose.cells.b.a.b.zu(Color.fromArgb(var1, 120, 120, 191));

         try {
            com.aspose.cells.b.a.b.zt var8;
            do {
               if (var6 != null) {
                  var6.n();
               }

               var6 = zbuk.a(var5, (float)var4, 0);
               var8 = this.k.a(var2, var6);
               if ((double)var8.b() < (double)var3.e() * 0.55D) {
                  ++var4;
               } else {
                  if ((double)var8.b() <= (double)var3.e() * 0.8D) {
                     break;
                  }

                  --var4;
               }
            } while(var4 > 1);

            float var9 = (float)var3.g() + ((float)var3.e() - var8.b()) / 2.0F;
            float var10 = (float)var3.h() + ((float)var3.f() - var8.c()) / 2.0F;
            com.aspose.cells.b.a.b.zq var11 = new com.aspose.cells.b.a.b.zq(var9, var10, var8.b(), var8.c());
            com.aspose.cells.b.a.b.a.zf var12 = this.k.e();
            if (this.i().c().i() && this.k.j() != 4) {
               this.k.b(4);
            }

            this.k.a(var2, var6, (com.aspose.cells.b.a.b.zc)var7, (com.aspose.cells.b.a.b.zq)var11);
            this.k.a(var12);
            if (var6 != null) {
               var6.n();
            }
         } finally {
            if (var7 != null) {
               var7.f();
            }

         }

      }
   }

   private void at() throws Exception {
      for(int var1 = 0; var1 < this.W().getCount(); ++var1) {
         zig var2 = this.P.b(var1);
         com.aspose.cells.b.a.d.zh var3 = new com.aspose.cells.b.a.d.zh();

         try {
            int var4 = zadb.b;
            zn var5 = zadb.a(var4, var2.T().b(), var2.T().c(), ImageFormat.getEmf(), (ImageOrPrintOptions)null, var3, var2);
            var5.l();
            if (var3.h() != 0L) {
               var3.a(0L, 0);
               com.aspose.cells.b.a.b.zj var6 = com.aspose.cells.b.a.b.zj.a((com.aspose.cells.b.a.d.zm)var3);

               try {
                  this.ap().a(var6, var2.c(), var2.d(), var2.a(), var2.b());
               } finally {
                  if (var6 != null) {
                     var6.b();
                  }

               }
            }
         } finally {
            if (var3 != null) {
               var3.a();
            }

         }
      }

   }

   protected void finalize() throws Exception {
      this.g(false);
   }

   public void ar() {
      this.g(true);
      com.aspose.cells.b.a.zg.a(this);
   }

   protected void g(boolean var1) {
      if (!this.ag) {
         if (var1) {
            if (this.p != null) {
               this.p.n();
            }

            if (this.t != null) {
               this.t.H();
            }

            if (this.s != null) {
               this.s.H();
            }

            if (this.y != null) {
               this.y.t();
            }

            if (this.u != null) {
               this.u.n();
            }

            if (this.G != null) {
               this.G.l();
            }

            if (this.H != null) {
               this.H.l();
            }

            if (this.I != null) {
               this.I.l();
            }

            if (this.J != null) {
               this.J.e();
            }

            if (this.l != null) {
               this.l.af();
            }

            if (this.m != null) {
               this.m.af();
            }

            if (this.n != null) {
               this.n.af();
            }

            if (this.o != null) {
               this.o.af();
            }

            if (this.z != null) {
               this.z.af();
            }

            int var2;
            if (this.r != null) {
               for(var2 = 0; var2 < this.r.getCount(); ++var2) {
                  zbcq var3 = this.r.c(var2);
                  if (var3 != null) {
                     var3.aD();
                  }
               }
            }

            if (this.P != null) {
               for(var2 = 0; var2 < this.P.getCount(); ++var2) {
                  zig var4 = this.P.b(var2);
                  if (var4 != null) {
                     var4.ar();
                  }
               }
            }
         }

         this.ag = true;
      }

   }
}
